import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/dashboard'
  },
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: () => import ('@/views/Dashboard')
  },
  {
    path: '/advisory',
    name: 'Advisory',
    component: () => import ('@/views/Advisory')
  },
  {
    path: '/case',
    name: 'Case',
    component: () => import ('@/views/Case')
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('@/views/About')
  },
  {
    path: '/join',
    name: 'Join',
    component: () => import('@/views/Join')
  },
  {
    path: '/adDetail',
    name: 'AdDetail',
    component: () => import('@/views/AdDetail')
  },
  {
    path: '/caseDetail',
    name: 'CaseDetail',
    component: () => import('@/views/CaseDetail')
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})
router.afterEach((to, from, next) => {
  sessionStorage.setItem('viewOther', sessionStorage.getItem('viewOther') + '0')
  // console.log('router boolean', sessionStorage.getItem('viewOther'))
  window.scrollTo(0, 0)
})
export default router
